package org.dentalcard.ui.api.tools;

import javax.swing.table.AbstractTableModel;
import java.util.Arrays;
import java.util.List;

/**
 * @user: Vladimir Chernishov
 * @date: 21.12.11
 * @time: 10:29
 */
public abstract class AbstractDecTableModel extends AbstractTableModel{

    private List<String> сolumnIdentifiers;


    public AbstractDecTableModel(String[] columns) {
        сolumnIdentifiers = Arrays.asList(columns);
    }

    @Override
    public String getColumnName(int column) {
        return сolumnIdentifiers.get(column);
    }

    @Override
    public int findColumn(String columnName) {
        return сolumnIdentifiers.indexOf(columnName);
    }

    @Override
    public Class<?> getColumnClass(int columnIndex) {
        return Object.class;
    }

    @Override
    public int getColumnCount() {
        return сolumnIdentifiers.size();
    }
}
